//package com.source.code.variable;
//
///**
// * 变量类型查找器
// *
// * @author wangchangjie
// * @date 2024/02/01
// */
//
//import com.github.javaparser.ast.CompilationUnit;
//import com.github.javaparser.ast.body.VariableDeclarator;
//import com.github.javaparser.ast.visitor.VoidVisitorAdapter;
//
//
//public class VariableTypeFinder extends VoidVisitorAdapter<Void> {
//    private String targetVariableName;
//    private String variableType;
//    private ImportResolver importResolver;
//
//    public VariableTypeFinder(String targetVariableName) {
//        this.targetVariableName = targetVariableName;
//    }
//
//    public VariableTypeFinder(String targetVariableName, ImportResolver importResolver) {
//        this.targetVariableName = targetVariableName;
//        this.variableType = null;
//        this.importResolver = importResolver;
//    }
//
//    public String getVariableType() {
//        return variableType;
//    }
//
//    public void findVariableType(CompilationUnit compilationUnit) {
//        importResolver.resolveImports(compilationUnit);
//        visit(compilationUnit, null);
//    }
//
//    @Override
//    public void visit(VariableDeclarator variableDeclarator, Void arg) {
//        String variableName = variableDeclarator.getNameAsString();
//        if (variableName.equals(targetVariableName)) {
//            String variableTypeSimpleName = variableDeclarator.getType().toString();
//            String fullyQualifiedClassName = importResolver.resolveFullyQualifiedClassName(variableTypeSimpleName);
//            variableType = fullyQualifiedClassName;
//        }
//    }
//
//}
